﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace DownloadInterface
{
    public enum DownloadTaskOperation
    {
        DOWNLOAD_PAUSE,
        DOWNLOAD_CONTINUE,
        DOWNLOAD_CANCEL,
        DOWNLOAD_NEW
    }

    public delegate void DownloadCompletedEventHandler(DownloadTask finishedTask);

    public delegate void DownloadErrorEventHandler(DownloadError.ErrorCode errorCode);

    public interface IDownloadManage
    {

        // 事件，当下载结束时发生
        event DownloadCompletedEventHandler DownloadCompleted;

        event DownloadErrorEventHandler DownloadErrorEvent;

        // 开始一个新的下载，返回下载任务的ID
        bool startDownload(DownloadTask downloadTask);

        // 获取当前的下载任务列表 
        // 返回一个包含downloadId的list
        ObservableCollection<DownloadTask> getDownloadList();

        void SaveState();

        void operateDownload(DownloadTask task, DownloadTaskOperation operation);
    }
}
